package com.safeluck.floatwindow;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 相关参数
 * aaa
 * Created by lzw on 2018/9/27. 16:26:07
 * 邮箱：632393724@qq.com
 * All Rights Saved! Chongqing AnYun Tech co. LTD
 */
public class MediaArgu implements Parcelable {

    private boolean isPush;//是否推流 true-是
    private boolean usedOutCamera;//默认false 使用内置摄像头， true使用外置摄像头


    private int codeRate = 0;// 码率
    private int frameRate = 0;// 帧率
    private ScreenSolution m_screen;
    private String url;//ftp上传地址
    private String userName;//ftp上传用户名
    private String pwd;//ftp上传密码
    private int recordTime;//分钟


private int tfCardFlag =0; //0-内部flash 1- 外置tfcard

    public int getTfCardFlag() {
        return tfCardFlag;
    }

    public void setTfCardFlag(int tfCardFlag) {
        this.tfCardFlag = tfCardFlag;
    }

    public int getRecordTime() {
        return recordTime;
    }

    public void setRecordTime(int recordTime) {
        this.recordTime = recordTime;
    }

    public boolean isPush() {
        return isPush;
    }

    public void setPush(boolean push) {
        isPush = push;
    }

    public boolean isUsedOutCamera() {
        return usedOutCamera;
    }

    public void setUsedOutCamera(boolean usedOutCamera) {
        this.usedOutCamera = usedOutCamera;
    }

    public int getCodeRate() {
        return codeRate;
    }

    public void setCodeRate(int codeRate) {
        this.codeRate = codeRate;
    }

    public int getFrameRate() {
        return frameRate;
    }

    public void setFrameRate(int frameRate) {
        this.frameRate = frameRate;
    }

    public ScreenSolution getM_screen() {
        return m_screen;
    }

    public void setM_screen(ScreenSolution m_screen) {
        this.m_screen = m_screen;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

  public  static class ScreenSolution implements Parcelable {
        int width;
        int height;

        public ScreenSolution(int width, int height) {
            this.width = width;
            this.height = height;
        }


      public int getWidth() {
          return width;
      }

      public int getHeight() {
          return height;
      }

      @Override
       public String toString() {
           return "ScreenSolution{" +
                   "width=" + width +
                   ", height=" + height +
                   '}';
       }

      @Override
      public boolean equals(Object obj) {
          if (this.getClass() != obj.getClass()){
              return false;
          }
          ScreenSolution screenSolution = (ScreenSolution) obj;
          return (this.width == screenSolution.width) &&(this.height == screenSolution.height);
      }

      @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(this.width);
            dest.writeInt(this.height);
        }

        protected ScreenSolution(Parcel in) {
            this.width = in.readInt();
            this.height = in.readInt();
        }

        public static final Creator<ScreenSolution> CREATOR = new Creator<ScreenSolution>() {
            @Override
            public ScreenSolution createFromParcel(Parcel source) {
                return new ScreenSolution(source);
            }

            @Override
            public ScreenSolution[] newArray(int size) {
                return new ScreenSolution[size];
            }
        };
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeByte(this.isPush ? (byte) 1 : (byte) 0);
        dest.writeByte(this.usedOutCamera ? (byte) 1 : (byte) 0);
        dest.writeInt(this.codeRate);
        dest.writeInt(this.frameRate);

        dest.writeParcelable(this.m_screen, flags);
        dest.writeString(this.url);
        dest.writeString(this.userName);
        dest.writeString(this.pwd);
        dest.writeInt(this.recordTime);
        dest.writeInt(this.tfCardFlag);
    }

    public MediaArgu() {
    }

    protected MediaArgu(Parcel in) {
        this.isPush = in.readByte() != 0;
        this.usedOutCamera = in.readByte() != 0;
        this.codeRate = in.readInt();
        this.frameRate = in.readInt();
        this.m_screen = in.readParcelable(ScreenSolution.class.getClassLoader());
        this.url = in.readString();
        this.userName = in.readString();
        this.pwd = in.readString();
        this.recordTime = in.readInt();
        this.tfCardFlag = in.readInt();
    }

    public static final Parcelable.Creator<MediaArgu> CREATOR = new Parcelable.Creator<MediaArgu>() {
        @Override
        public MediaArgu createFromParcel(Parcel source) {
            return new MediaArgu(source);
        }

        @Override
        public MediaArgu[] newArray(int size) {
            return new MediaArgu[size];
        }
    };

    @Override
    public String toString() {
        return "MediaArgu{" +
                "isPush=" + isPush +
                ", usedOutCamera=" + usedOutCamera +
                ", codeRate=" + codeRate +
                ", frameRate=" + frameRate +
                ", m_screen=" + m_screen +
                ", url='" + url + '\'' +
                ", userName='" + userName + '\'' +
                ", pwd='" + pwd + '\'' +
                ", recordTime=" + recordTime +
                ", tfcardFlag=" + tfCardFlag +
                '}';
    }
}
